home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / Falcon / WHIP031 / VLM / WHIPTU11 / SOURCE / TUNNEL.S < prev   
Encoding:
Text File  |  1999-06-11  |  7.3 KB  |  369 lines

  1. ;
  2. ; VLM EXAMPLE MODULE                                             NO/Escape'98
  3. ;
  4.  
  5.                 ;OUTPUT 'E:\VOODOO\VLM\EXAMPLE.VLM'
  6.                 TEXT
  7.  
  8. *** VLM STRUCTURE **************************************************************
  9.  
  10.                 DC.B "VLM2"     ;vlm module type
  11.                 DC.L infotext   ;pointer to infotext
  12.                 DC.L settings   ;pointer to settings-structure
  13.                 DC.L init       ;pointer to init routine
  14.                 DC.L deinit     ;pointer to deinit routine
  15.                 DC.L main       ;pointer to mainloop routine
  16.  
  17. ;SERVICE ROUTINES PROVIDED BY THE CALLING PROGRAM
  18.  
  19. set_vblrout:
  20. ;a0: new vbl subroutine
  21.                 movea.l service_struct,A1
  22.                 movea.l (A1),A1
  23.                 jsr     (A1)
  24.                 rts
  25.  
  26. wait_vbl:
  27.                 movea.l service_struct,A1
  28.                 movea.l 4(A1),A1
  29.                 jsr     (A1)
  30.                 rts
  31.  
  32. set_scradr:
  33. ;a0: new screen adress
  34.                 movea.l service_struct,A1
  35.                 movea.l 8(A1),A1
  36.                 jsr     (A1)
  37.                 rts
  38.  
  39. set_resolution:
  40. ;d0: number of the wanted resolution
  41.                 movea.l service_struct,A1
  42.                 movea.l 12(A1),A1
  43.                 jsr     (A1)
  44.                 rts
  45.  
  46. get_left_spec:
  47.                 movea.l service_struct,A1
  48.                 movea.l 16(A1),A1
  49.                 jsr     (A1)            ;returns in a0 the adress of left spec
  50.                 rts
  51.  
  52. get_right_spec:
  53.                 movea.l service_struct,A1
  54.                 movea.l 20(A1),A1
  55.                 jsr     (A1)            ;returns in a0 the adress of right spec
  56.                 rts
  57.  
  58. get_left_volume:
  59.                 movea.l service_struct,A1
  60.                 movea.l 24(A1),A1
  61.                 jsr     (A1)            ;returns in d0 the left volume value
  62.                 rts
  63.  
  64. get_right_volume:
  65.                 movea.l service_struct,A1
  66.                 movea.l 28(A1),A1
  67.                 jsr     (A1)            ;returns in d0 the right volume value
  68.                 rts
  69.  
  70. get_left_osci:
  71.                 movea.l service_struct,A1
  72.                 movea.l 32(A1),A1
  73.                 jsr     (A1)            ;returns in a0 the adress of osci data
  74.                 rts
  75.  
  76. get_right_osci:
  77.                 movea.l service_struct,A1
  78.                 movea.l 36(A1),A1
  79.                 jsr     (A1)            ;returns in a0 the adress of osci data
  80.                 rts
  81.  
  82. service_struct: DC.L 0          ;must be set in 'init'
  83.  
  84. ********************************************************************************
  85. infotext:       
  86.                 DC.B 'tunnel scroller',0
  87.                 DC.B ' author: evil ',0
  88.                 DC.B 'version: 1.1',0
  89.                 DC.B '   date: june 12, 1999',0
  90.                 DC.B 0
  91.                 EVEN
  92.  
  93. settings:       dc.l    7
  94.  
  95.         dc.l    scrname
  96.         dc.l    1
  97. screnabled:    dc.l    1
  98.         dc.l    0
  99.  
  100.  
  101.         dc.l    rotname
  102.         dc.l    1
  103. rotenabled:    dc.l    1
  104.         dc.l    0
  105.  
  106.         dc.l    scr_speedname
  107.         dc.l    3
  108. scr_speed:    dc.l    16
  109.         dc.l    scr_speedstruct
  110.  
  111.         dc.l    rot_speedname
  112.         dc.l    3
  113. rot_speed:    dc.l    1024
  114.         dc.l    rot_speedstruct
  115.  
  116.  
  117.         dc.l    rottriggername
  118.         dc.l    3
  119. rottrigval:    dc.l    14000
  120.         dc.l    rottrigstruct
  121.  
  122.         dc.l    scrtriggername
  123.         dc.l    3
  124. scrtrigval:    dc.l    14000
  125.         dc.l    scrtrigstruct
  126.  
  127.  
  128.         dc.l    timeslicename
  129.         dc.l    3
  130. timeslice:    dc.l    4
  131.         dc.l    timeslicestr
  132.  
  133.  
  134. timeslicestr:    dc.l    1,20
  135. rottrigstruct:    dc.l    1000,20000
  136. scrtrigstruct:    dc.l    1000,20000
  137. scr_speedstruct:dc.l    0,128
  138. rot_speedstruct:dc.l    0,16384
  139.  
  140.  
  141. timeslicename:    dc.b    'TOGGLE TIMESLICE:',0
  142.         even
  143. scr_speedname:    dc.b    'SCROLL SPEED:',0
  144.         even
  145. rot_speedname:    dc.b    'ROTATION SPEED:',0
  146.         even
  147.  
  148. rottriggername:    dc.b    'ROTATION TRIGGER:',0
  149.         even
  150. scrtriggername:    dc.b    'SCROLL TRIGGER:',0
  151.         even
  152. rotname:    dc.b    'TOGGLE ROTATION: ',0
  153.         even
  154. scrname:    dc.b    'TOGGLE SCROLLDIR:',0
  155.         even
  156.  
  157.  
  158.  
  159. init:           
  160. ;a0: service structure
  161.                 move.l  A0,service_struct
  162.  
  163.         bsr.w    tunnel_init
  164.         bsr.w    clear_screens
  165.  
  166.                 movea.l scradr2,A0      ;set new screen adress
  167.                 bsr     set_scradr
  168.  
  169.                 move.l  #2,D0           ;set resolution to 320x100
  170.                 bsr     set_resolution
  171.                 rts
  172. deinit:         
  173.                 rts
  174. main:           
  175.                 jsr     wait_vbl
  176.                 jsr     switch_screens
  177.  
  178.         bsr.w    tunnel_main
  179.  
  180.                 rts                     ;end of the mainroutine
  181.  
  182. clear_screens:
  183.         move.l    scradr1,a0
  184.         move.l    scradr2,a1
  185.         move.l    scradr3,a2
  186.         move.w    #320*100*2/64-1,d7
  187. .loop:        rept    16
  188.         clr.l    (a0)+
  189.         clr.l    (a1)+
  190.         clr.l    (a2)+
  191.         endr
  192.         dbra    d7,.loop
  193.         rts
  194.  
  195.  
  196. tunnel_vbl:
  197.         tst.w    scrdir
  198.         beq.s    .scrollsub
  199.         move.l    scr_speed,d0
  200.         bclr    #0,d0
  201.         add.l    d0,tunnel_scrl        ;scroll
  202.         bra.s    .scrolldone
  203. .scrollsub:    move.l    scr_speed,d0
  204.         bclr    #0,d0
  205.         sub.l    d0,tunnel_scrl        ;scroll
  206.  
  207.  
  208. .scrolldone:    tst.w    rotdir
  209.         beq.s    .rotsub
  210.         move.l    rot_speed,d0
  211.         and.l    #%11111111111111111111110000000000,d0
  212.         add.l    d0,tunnel_scrl    ;rot
  213.         bra.s    .alldone
  214. .rotsub:    move.l    rot_speed,d0
  215.         and.l    #%11111111111111111111110000000000,d0
  216.         sub.l    d0,tunnel_scrl    ;rot
  217.  
  218. .alldone:
  219.  
  220.  
  221.         rts
  222.  
  223.  
  224. tunnel_main:
  225.  
  226.         subq.l    #1,countdown
  227.         bne.w    .done
  228.  
  229.         move.l    timeslice,countdown
  230.  
  231.  
  232.  
  233. .leftcol:    tst.l    screnabled
  234.         beq.s    .rightvol
  235.  
  236.         bsr.w    get_left_volume
  237.         move.l    scrtrigval,d1
  238.         cmp.l    d1,d0
  239.         bgt.s    .changescr
  240.         bra.s    .rightvol
  241. .changescr:    not.w    scrdir
  242. .rightvol:    tst.l    rotenabled
  243.         beq.s    .done
  244.  
  245.         bsr.w    get_right_volume
  246.         move.l    rottrigval,d1
  247.         cmp.l    d1,d0
  248.         bgt.s    .changerot
  249.         bra.s    .done
  250. .changerot:    not.w    rotdir
  251.  
  252. .done:
  253.  
  254.         and.l    #$1ffff,tunnel_scrl
  255.  
  256.         move.l    scradr1,a0
  257.         lea.l    64(a0),a0
  258.         lea.l    tunnel_lut,a1
  259.         lea.l    tunnel_txt,a2
  260.         add.l    tunnel_scrl,a2
  261.  
  262.         clr.l    d0
  263.         
  264.         move.w    #100-1,d7
  265. yloop:        swap    d7
  266.         move.w    #128/16-1,d7
  267. xloop:
  268.         rept    16
  269.         move.w    (a1)+,d0
  270.         move.l    (a2,d0.l*2),(a0)+
  271.         endr
  272.  
  273.  
  274.         dbra    d7,xloop
  275.         lea.l    128(a0),a0
  276.         swap    d7
  277.         dbra    d7,yloop
  278.  
  279.  
  280.         rts
  281.  
  282.  
  283.  
  284. countdown:    dc.l    1
  285. tunnel_scrl:    ds.l    1
  286. scrdir:        ds.w    1
  287. rotdir:        ds.w    1
  288.  
  289.  
  290.  
  291. tunnel_init:
  292.         lea.l    tunnel_vbl,a0
  293.         bsr.w    set_vblrout
  294.  
  295.         lea.l    tunnel_rawtxt,a0
  296.         lea.l    tunnel_txt,a1
  297.         lea.l    tunnel_txt+512,a2
  298.         lea.l    tunnel_txt+512*255,a3
  299.         lea.l    tunnel_txt+512*255+512,a4
  300.  
  301.         move.w    #128-1,d7
  302. .loop:        move.w    #128-1,d6
  303. .loop2:        move.w    (a0)+,d0
  304.         move.w    d0,(a1)+
  305.         move.w    d0,-(a2)
  306.         move.w    d0,(a3)+
  307.         move.w    d0,-(a4)
  308.  
  309.         dbra    d6,.loop2
  310.         lea.l    256(a1),a1
  311.         lea.l    768(a2),a2
  312.         lea.l    -768(a3),a3
  313.         lea.l    -256(a4),a4
  314.         dbra    d7,.loop
  315.  
  316.  
  317.         lea.l    tunnel_txt,a0
  318.         lea.l    tunnel_txt+256*256*2,a1
  319.         move.w    #256*256*2/64-1,d7
  320. .loop3:        rept    16
  321.         move.l    (a0)+,(a1)+
  322.         endr
  323.         dbra    d7,.loop3
  324.         rts
  325.  
  326.         even
  327.  
  328. tunnel_lut:    incbin    'tunnel.dat'
  329.         even
  330.  
  331. tunnel_rawtxt:    incbin    'tunnel.16b'
  332.  
  333.         even
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343. ;ROUTINE SWITCHES VISIBLE SCREEN AND CYCLES THE SCREENADRESSES
  344. switch_screens:
  345.                 move.l  scradr3,D0
  346.                 move.l  scradr2,scradr3
  347.                 move.l  scradr1,scradr2
  348.                 move.l  D0,scradr1
  349.                 movea.l scradr2,A0
  350.                 jsr     set_scradr
  351.                 rts
  352.  
  353.  
  354.  
  355. scradr1:        Dc.L scr1+256
  356. scradr2:        Dc.L scr2+256
  357. scradr3:        Dc.L scr3+256
  358.  
  359.                 BSS
  360.  
  361. tunnel_txt:    ds.w    256*512
  362.  
  363.  
  364. scr1:        ds.w    320*100
  365. scr2:        ds.w    320*100
  366. scr3:        ds.w    320*100
  367.  
  368.                 END
  369.